<?

include_once($_SERVER['DOCUMENT_ROOT'] . "/includes/loader.inc.php");
$session = Session::getInstance();
$_info = $session->getAll();


$interno = 'SIP/' . $_info['usuario']['interno'];
$destino = '9' . addslashes($_GET['destino']);

echo $interno . '<br>';
echo $destino;

$server = '190.228.105.3';
$port = '5038';
$admuser = 'fopmanager';
$admpass = 'l1v3Xon@';
$cid = '45566400';
$command = 'Action: login
Username: fopmanager
Secret: l1v3Xon@

Action: Originate
Channel: '.$interno.'
Context: salientes
Exten: '.$destino.'
Priority: 1
Callerid: '.$cid.'
Timeout: 30000

';

$sock = fsockopen($server,$port);
stream_set_timeout($sock,3);
fwrite($sock, $command);
fclose($sock);
?>